import request from '/@/api/request'

/** 获取角色列表 */
export const requestRoleList = (data: RoleListTypes.IRequest) => {
  return request.post<IPaginationResponse<RoleListTypes.IResponse[]>>('/system/ysys-user/role/roleList/V1', data)
}

/** 根据角色id获取角色详情 */
export const requestGetRoleById = (data: GetRoleByIdTypes.IRequest) => {
  return request.post<IBaseResponse<GetRoleByIdTypes.IResponse>>('/system/ysys-user/role/getRoleById/V1', data)
}

/** 添加角色 */
export const requestSaveRole = (data: SaveRoleTypes.IRequest) => {
  return request.post<IBaseResponse<SaveRoleTypes.IResponse>>('/system/ysys-user/role/saveRole/V1', data)
}

/** 修改角色 */
export const requestUpdateRole = (data: UpdateRoleTypes.IRequest) => {
  return request.post<IBaseResponse<UpdateRoleTypes.IResponse>>('/system/ysys-user/role/updateRole/V1', data)
}

/** 删除角色 */
export const requestDelRole = (data: DelRoleTypes.IRequest) => {
  return request.post<IBaseResponse<DelRoleTypes.IResponse>>('/system/ysys-user/role/delRole/V1', data)
}

/** 角色关联菜单 */
export const requestSaveRolePermission = (data: SaveRolePermissionTypes.IRequest) => {
  return request.post<IBaseResponse<SaveRolePermissionTypes.IResponse>>('/system/ysys-user/role/saveRolePermission/V1', data)
}

/** 获取角色已关联菜单 */
export const requestGetRolePermission = (data: GetRolePermissionTypes.IRequest) => {
  return request.post<IPaginationResponse<GetRolePermissionTypes.IResponse[]>>('/system/ysys-user/role/getRolePermission/V1', data)
}

/** 获取机构角色列表 */
export const requestRoleListByType = (data: RoleListByTypeTypes.IRequest) => {
  return request.post<IPaginationResponse<RoleListByTypeTypes.IResponse[]>>('/system/ysys-user/role/roleListByType/V1', data)
}
